home *** CD-ROM | disk | FTP | other *** search
/ SGI Freeware 1999 August / SGI Freeware 1999 August.iso / dist / fw_xemacs.idb / usr / freeware / lib / xemacs-20.4 / info / lispref.info-23.z / lispref.info-23
Encoding:
GNU Info File  |  1998-05-21  |  49.2 KB  |  1,163 lines

  1. This is Info file ../../info/lispref.info, produced by Makeinfo version
  2. 1.68 from the input file lispref.texi.
  3.  
  4.    Edition History:
  5.  
  6.    GNU Emacs Lisp Reference Manual Second Edition (v2.01), May 1993 GNU
  7. Emacs Lisp Reference Manual Further Revised (v2.02), August 1993 Lucid
  8. Emacs Lisp Reference Manual (for 19.10) First Edition, March 1994
  9. XEmacs Lisp Programmer's Manual (for 19.12) Second Edition, April 1995
  10. GNU Emacs Lisp Reference Manual v2.4, June 1995 XEmacs Lisp
  11. Programmer's Manual (for 19.13) Third Edition, July 1995 XEmacs Lisp
  12. Reference Manual (for 19.14 and 20.0) v3.1, March 1996 XEmacs Lisp
  13. Reference Manual (for 19.15 and 20.1, 20.2) v3.2, April, May 1997
  14.  
  15.    Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995 Free Software
  16. Foundation, Inc.  Copyright (C) 1994, 1995 Sun Microsystems, Inc.
  17. Copyright (C) 1995, 1996 Ben Wing.
  18.  
  19.    Permission is granted to make and distribute verbatim copies of this
  20. manual provided the copyright notice and this permission notice are
  21. preserved on all copies.
  22.  
  23.    Permission is granted to copy and distribute modified versions of
  24. this manual under the conditions for verbatim copying, provided that the
  25. entire resulting derived work is distributed under the terms of a
  26. permission notice identical to this one.
  27.  
  28.    Permission is granted to copy and distribute translations of this
  29. manual into another language, under the above conditions for modified
  30. versions, except that this permission notice may be stated in a
  31. translation approved by the Foundation.
  32.  
  33.    Permission is granted to copy and distribute modified versions of
  34. this manual under the conditions for verbatim copying, provided also
  35. that the section entitled "GNU General Public License" is included
  36. exactly as in the original, and provided that the entire resulting
  37. derived work is distributed under the terms of a permission notice
  38. identical to this one.
  39.  
  40.    Permission is granted to copy and distribute translations of this
  41. manual into another language, under the above conditions for modified
  42. versions, except that the section entitled "GNU General Public License"
  43. may be included in a translation approved by the Free Software
  44. Foundation instead of in the original English.
  45.  
  46. 
  47. File: lispref.info,  Node: Format Conversion,  Next: Files and MS-DOS,  Prev: Partial Files,  Up: Files
  48.  
  49. File Format Conversion
  50. ======================
  51.  
  52.    The variable `format-alist' defines a list of "file formats", which
  53. describe textual representations used in files for the data (text,
  54. text-properties, and possibly other information) in an Emacs buffer.
  55. Emacs performs format conversion if appropriate when reading and writing
  56. files.
  57.  
  58.  - Variable: format-alist
  59.      This list contains one format definition for each defined file
  60.      format.
  61.  
  62.    Each format definition is a list of this form:
  63.  
  64.      (NAME DOC-STRING REGEXP FROM-FN TO-FN MODIFY MODE-FN)
  65.  
  66.    Here is what the elements in a format definition mean:
  67.  
  68. NAME
  69.      The name of this format.
  70.  
  71. DOC-STRING
  72.      A documentation string for the format.
  73.  
  74. REGEXP
  75.      A regular expression which is used to recognize files represented
  76.      in this format.
  77.  
  78. FROM-FN
  79.      A function to call to decode data in this format (to convert file
  80.      data into the usual Emacs data representation).
  81.  
  82.      The FROM-FN is called with two args, BEGIN and END, which specify
  83.      the part of the buffer it should convert.  It should convert the
  84.      text by editing it in place.  Since this can change the length of
  85.      the text, FROM-FN should return the modified end position.
  86.  
  87.      One responsibility of FROM-FN is to make sure that the beginning
  88.      of the file no longer matches REGEXP.  Otherwise it is likely to
  89.      get called again.
  90.  
  91. TO-FN
  92.      A function to call to encode data in this format (to convert the
  93.      usual Emacs data representation into this format).
  94.  
  95.      The TO-FN is called with two args, BEGIN and END, which specify
  96.      the part of the buffer it should convert.  There are two ways it
  97.      can do the conversion:
  98.  
  99.         * By editing the buffer in place.  In this case, TO-FN should
  100.           return the end-position of the range of text, as modified.
  101.  
  102.         * By returning a list of annotations.  This is a list of
  103.           elements of the form `(POSITION . STRING)', where POSITION is
  104.           an integer specifying the relative position in the text to be
  105.           written, and STRING is the annotation to add there.  The list
  106.           must be sorted in order of position when TO-FN returns it.
  107.  
  108.           When `write-region' actually writes the text from the buffer
  109.           to the file, it intermixes the specified annotations at the
  110.           corresponding positions.  All this takes place without
  111.           modifying the buffer.
  112.  
  113. MODIFY
  114.      A flag, `t' if the encoding function modifies the buffer, and
  115.      `nil' if it works by returning a list of annotations.
  116.  
  117. MODE
  118.      A mode function to call after visiting a file converted from this
  119.      format.
  120.  
  121.    The function `insert-file-contents' automatically recognizes file
  122. formats when it reads the specified file.  It checks the text of the
  123. beginning of the file against the regular expressions of the format
  124. definitions, and if it finds a match, it calls the decoding function for
  125. that format.  Then it checks all the known formats over again.  It
  126. keeps checking them until none of them is applicable.
  127.  
  128.    Visiting a file, with `find-file-noselect' or the commands that use
  129. it, performs conversion likewise (because it calls
  130. `insert-file-contents'); it also calls the mode function for each
  131. format that it decodes.  It stores a list of the format names in the
  132. buffer-local variable `buffer-file-format'.
  133.  
  134.  - Variable: buffer-file-format
  135.      This variable states the format of the visited file.  More
  136.      precisely, this is a list of the file format names that were
  137.      decoded in the course of visiting the current buffer's file.  It
  138.      is always local in all buffers.
  139.  
  140.    When `write-region' writes data into a file, it first calls the
  141. encoding functions for the formats listed in `buffer-file-format', in
  142. the order of appearance in the list.
  143.  
  144.  - Function: format-write-file FILE FORMAT
  145.      This command writes the current buffer contents into the file FILE
  146.      in format FORMAT, and makes that format the default for future
  147.      saves of the buffer.  The argument FORMAT is a list of format
  148.      names.
  149.  
  150.  - Function: format-find-file FILE FORMAT
  151.      This command finds the file FILE, converting it according to
  152.      format FORMAT.  It also makes FORMAT the default if the buffer is
  153.      saved later.
  154.  
  155.      The argument FORMAT is a list of format names.  If FORMAT is
  156.      `nil', no conversion takes place.  Interactively, typing just
  157.      <RET> for FORMAT specifies `nil'.
  158.  
  159.  - Function: format-insert-file FILE FORMAT &optional BEG END
  160.      This command inserts the contents of file FILE, converting it
  161.      according to format FORMAT.  If BEG and END are non-`nil', they
  162.      specify which part of the file to read, as in
  163.      `insert-file-contents' (*note Reading from Files::.).
  164.  
  165.      The return value is like what `insert-file-contents' returns: a
  166.      list of the absolute file name and the length of the data inserted
  167.      (after conversion).
  168.  
  169.      The argument FORMAT is a list of format names.  If FORMAT is
  170.      `nil', no conversion takes place.  Interactively, typing just
  171.      <RET> for FORMAT specifies `nil'.
  172.  
  173.  - Function: format-find-file FILE FORMAT
  174.      This command finds the file FILE, converting it according to
  175.      format FORMAT.  It also makes FORMAT the default if the buffer is
  176.      saved later.
  177.  
  178.      The argument FORMAT is a list of format names.  If FORMAT is
  179.      `nil', no conversion takes place.  Interactively, typing just
  180.      <RET> for FORMAT specifies `nil'.
  181.  
  182.  - Function: format-insert-file FILE FORMAT &optional BEG END
  183.      This command inserts the contents of file FILE, converting it
  184.      according to format FORMAT.  If BEG and END are non-`nil', they
  185.      specify which part of the file to read, as in
  186.      `insert-file-contents' (*note Reading from Files::.).
  187.  
  188.      The return value is like what `insert-file-contents' returns: a
  189.      list of the absolute file name and the length of the data inserted
  190.      (after conversion).
  191.  
  192.      The argument FORMAT is a list of format names.  If FORMAT is
  193.      `nil', no conversion takes place.  Interactively, typing just
  194.      <RET> for FORMAT specifies `nil'.
  195.  
  196.  - Variable: auto-save-file-format
  197.      This variable specifies the format to use for auto-saving.  Its
  198.      value is a list of format names, just like the value of
  199.      `buffer-file-format'; but it is used instead of
  200.      `buffer-file-format' for writing auto-save files.  This variable
  201.      is always local in all buffers.
  202.  
  203. 
  204. File: lispref.info,  Node: Files and MS-DOS,  Prev: Format Conversion,  Up: Files
  205.  
  206. Files and MS-DOS
  207. ================
  208.  
  209.    Emacs on MS-DOS makes a distinction between text files and binary
  210. files.  This is necessary because ordinary text files on MS-DOS use a
  211. two character sequence between lines: carriage-return and linefeed
  212. (CRLF).  Emacs expects just a newline character (a linefeed) between
  213. lines.  When Emacs reads or writes a text file on MS-DOS, it needs to
  214. convert the line separators.  This means it needs to know which files
  215. are text files and which are binary.  It makes this decision when
  216. visiting a file, and records the decision in the variable
  217. `buffer-file-type' for use when the file is saved.
  218.  
  219.    *Note MS-DOS Subprocesses::, for a related feature for subprocesses.
  220.  
  221.  - Variable: buffer-file-type
  222.      This variable, automatically local in each buffer, records the
  223.      file type of the buffer's visited file.  The value is `nil' for
  224.      text, `t' for binary.
  225.  
  226.  - Function: find-buffer-file-type FILENAME
  227.      This function determines whether file FILENAME is a text file or a
  228.      binary file.  It returns `nil' for text, `t' for binary.
  229.  
  230.  - User Option: file-name-buffer-file-type-alist
  231.      This variable holds an alist for distinguishing text files from
  232.      binary files.  Each element has the form (REGEXP . TYPE), where
  233.      REGEXP is matched against the file name, and TYPE may be is `nil'
  234.      for text, `t' for binary, or a function to call to compute which.
  235.      If it is a function, then it is called with a single argument (the
  236.      file name) and should return `t' or `nil'.
  237.  
  238.  - User Option: default-buffer-file-type
  239.      This variable specifies the default file type for files whose names
  240.      don't indicate anything in particular.  Its value should be `nil'
  241.      for text, or `t' for binary.
  242.  
  243.  - Command: find-file-text FILENAME
  244.      Like `find-file', but treat the file as text regardless of its
  245.      name.
  246.  
  247.  - Command: find-file-binary FILENAME
  248.      Like `find-file', but treat the file as binary regardless of its
  249.      name.
  250.  
  251. 
  252. File: lispref.info,  Node: Backups and Auto-Saving,  Next: Buffers,  Prev: Files,  Up: Top
  253.  
  254. Backups and Auto-Saving
  255. ***********************
  256.  
  257.    Backup files and auto-save files are two methods by which XEmacs
  258. tries to protect the user from the consequences of crashes or of the
  259. user's own errors.  Auto-saving preserves the text from earlier in the
  260. current editing session; backup files preserve file contents prior to
  261. the current session.
  262.  
  263. * Menu:
  264.  
  265. * Backup Files::   How backup files are made; how their names are chosen.
  266. * Auto-Saving::    How auto-save files are made; how their names are chosen.
  267. * Reverting::      `revert-buffer', and how to customize what it does.
  268.  
  269. 
  270. File: lispref.info,  Node: Backup Files,  Next: Auto-Saving,  Up: Backups and Auto-Saving
  271.  
  272. Backup Files
  273. ============
  274.  
  275.    A "backup file" is a copy of the old contents of a file you are
  276. editing.  XEmacs makes a backup file the first time you save a buffer
  277. into its visited file.  Normally, this means that the backup file
  278. contains the contents of the file as it was before the current editing
  279. session.  The contents of the backup file normally remain unchanged once
  280. it exists.
  281.  
  282.    Backups are usually made by renaming the visited file to a new name.
  283. Optionally, you can specify that backup files should be made by copying
  284. the visited file.  This choice makes a difference for files with
  285. multiple names; it also can affect whether the edited file remains owned
  286. by the original owner or becomes owned by the user editing it.
  287.  
  288.    By default, XEmacs makes a single backup file for each file edited.
  289. You can alternatively request numbered backups; then each new backup
  290. file gets a new name.  You can delete old numbered backups when you
  291. don't want them any more, or XEmacs can delete them automatically.
  292.  
  293. * Menu:
  294.  
  295. * Making Backups::     How XEmacs makes backup files, and when.
  296. * Rename or Copy::     Two alternatives: renaming the old file or copying it.
  297. * Numbered Backups::   Keeping multiple backups for each source file.
  298. * Backup Names::       How backup file names are computed; customization.
  299.  
  300. 
  301. File: lispref.info,  Node: Making Backups,  Next: Rename or Copy,  Up: Backup Files
  302.  
  303. Making Backup Files
  304. -------------------
  305.  
  306.  - Function: backup-buffer
  307.      This function makes a backup of the file visited by the current
  308.      buffer, if appropriate.  It is called by `save-buffer' before
  309.      saving the buffer the first time.
  310.  
  311.  - Variable: buffer-backed-up
  312.      This buffer-local variable indicates whether this buffer's file has
  313.      been backed up on account of this buffer.  If it is non-`nil', then
  314.      the backup file has been written.  Otherwise, the file should be
  315.      backed up when it is next saved (if backups are enabled).  This is
  316.      a permanent local; `kill-local-variables' does not alter it.
  317.  
  318.  - User Option: make-backup-files
  319.      This variable determines whether or not to make backup files.  If
  320.      it is non-`nil', then XEmacs creates a backup of each file when it
  321.      is saved for the first time--provided that `backup-inhibited' is
  322.      `nil' (see below).
  323.  
  324.      The following example shows how to change the `make-backup-files'
  325.      variable only in the `RMAIL' buffer and not elsewhere.  Setting it
  326.      `nil' stops XEmacs from making backups of the `RMAIL' file, which
  327.      may save disk space.  (You would put this code in your `.emacs'
  328.      file.)
  329.  
  330.           (add-hook 'rmail-mode-hook
  331.                     (function (lambda ()
  332.                                 (make-local-variable
  333.                                  'make-backup-files)
  334.                                 (setq make-backup-files nil))))
  335.  
  336.  - Variable: backup-enable-predicate
  337.      This variable's value is a function to be called on certain
  338.      occasions to decide whether a file should have backup files.  The
  339.      function receives one argument, a file name to consider.  If the
  340.      function returns `nil', backups are disabled for that file.
  341.      Otherwise, the other variables in this section say whether and how
  342.      to make backups.
  343.  
  344.      The default value is this:
  345.  
  346.           (lambda (name)
  347.             (or (< (length name) 5)
  348.                 (not (string-equal "/tmp/"
  349.                                    (substring name 0 5)))))
  350.  
  351.  - Variable: backup-inhibited
  352.      If this variable is non-`nil', backups are inhibited.  It records
  353.      the result of testing `backup-enable-predicate' on the visited file
  354.      name.  It can also coherently be used by other mechanisms that
  355.      inhibit backups based on which file is visited.  For example, VC
  356.      sets this variable non-`nil' to prevent making backups for files
  357.      managed with a version control system.
  358.  
  359.      This is a permanent local, so that changing the major mode does
  360.      not lose its value.  Major modes should not set this
  361.      variable--they should set `make-backup-files' instead.
  362.  
  363. 
  364. File: lispref.info,  Node: Rename or Copy,  Next: Numbered Backups,  Prev: Making Backups,  Up: Backup Files
  365.  
  366. Backup by Renaming or by Copying?
  367. ---------------------------------
  368.  
  369.    There are two ways that XEmacs can make a backup file:
  370.  
  371.    * XEmacs can rename the original file so that it becomes a backup
  372.      file, and then write the buffer being saved into a new file.
  373.      After this procedure, any other names (i.e., hard links) of the
  374.      original file now refer to the backup file.  The new file is owned
  375.      by the user doing the editing, and its group is the default for
  376.      new files written by the user in that directory.
  377.  
  378.    * XEmacs can copy the original file into a backup file, and then
  379.      overwrite the original file with new contents.  After this
  380.      procedure, any other names (i.e., hard links) of the original file
  381.      still refer to the current version of the file.  The file's owner
  382.      and group will be unchanged.
  383.  
  384.    The first method, renaming, is the default.
  385.  
  386.    The variable `backup-by-copying', if non-`nil', says to use the
  387. second method, which is to copy the original file and overwrite it with
  388. the new buffer contents.  The variable `file-precious-flag', if
  389. non-`nil', also has this effect (as a sideline of its main
  390. significance).  *Note Saving Buffers::.
  391.  
  392.  - Variable: backup-by-copying
  393.      If this variable is non-`nil', XEmacs always makes backup files by
  394.      copying.
  395.  
  396.    The following two variables, when non-`nil', cause the second method
  397. to be used in certain special cases.  They have no effect on the
  398. treatment of files that don't fall into the special cases.
  399.  
  400.  - Variable: backup-by-copying-when-linked
  401.      If this variable is non-`nil', XEmacs makes backups by copying for
  402.      files with multiple names (hard links).
  403.  
  404.      This variable is significant only if `backup-by-copying' is `nil',
  405.      since copying is always used when that variable is non-`nil'.
  406.  
  407.  - Variable: backup-by-copying-when-mismatch
  408.      If this variable is non-`nil', XEmacs makes backups by copying in
  409.      cases where renaming would change either the owner or the group of
  410.      the file.
  411.  
  412.      The value has no effect when renaming would not alter the owner or
  413.      group of the file; that is, for files which are owned by the user
  414.      and whose group matches the default for a new file created there
  415.      by the user.
  416.  
  417.      This variable is significant only if `backup-by-copying' is `nil',
  418.      since copying is always used when that variable is non-`nil'.
  419.  
  420. 
  421. File: lispref.info,  Node: Numbered Backups,  Next: Backup Names,  Prev: Rename or Copy,  Up: Backup Files
  422.  
  423. Making and Deleting Numbered Backup Files
  424. -----------------------------------------
  425.  
  426.    If a file's name is `foo', the names of its numbered backup versions
  427. are `foo.~V~', for various integers V, like this: `foo.~1~', `foo.~2~',
  428. `foo.~3~', ..., `foo.~259~', and so on.
  429.  
  430.  - User Option: version-control
  431.      This variable controls whether to make a single non-numbered backup
  432.      file or multiple numbered backups.
  433.  
  434.     `nil'
  435.           Make numbered backups if the visited file already has
  436.           numbered backups; otherwise, do not.
  437.  
  438.     `never'
  439.           Do not make numbered backups.
  440.  
  441.     ANYTHING ELSE
  442.           Make numbered backups.
  443.  
  444.    The use of numbered backups ultimately leads to a large number of
  445. backup versions, which must then be deleted.  XEmacs can do this
  446. automatically or it can ask the user whether to delete them.
  447.  
  448.  - User Option: kept-new-versions
  449.      The value of this variable is the number of newest versions to keep
  450.      when a new numbered backup is made.  The newly made backup is
  451.      included in the count.  The default value is 2.
  452.  
  453.  - User Option: kept-old-versions
  454.      The value of this variable is the number of oldest versions to keep
  455.      when a new numbered backup is made.  The default value is 2.
  456.  
  457.    If there are backups numbered 1, 2, 3, 5, and 7, and both of these
  458. variables have the value 2, then the backups numbered 1 and 2 are kept
  459. as old versions and those numbered 5 and 7 are kept as new versions;
  460. backup version 3 is excess.  The function `find-backup-file-name'
  461. (*note Backup Names::.) is responsible for determining which backup
  462. versions to delete, but does not delete them itself.
  463.  
  464.  - User Option: trim-versions-without-asking
  465.      If this variable is non-`nil', then saving a file deletes excess
  466.      backup versions silently.  Otherwise, it asks the user whether to
  467.      delete them.
  468.  
  469.  - User Option: dired-kept-versions
  470.      This variable specifies how many of the newest backup versions to
  471.      keep in the Dired command `.' (`dired-clean-directory').  That's
  472.      the same thing `kept-new-versions' specifies when you make a new
  473.      backup file.  The default value is 2.
  474.  
  475. 
  476. File: lispref.info,  Node: Backup Names,  Prev: Numbered Backups,  Up: Backup Files
  477.  
  478. Naming Backup Files
  479. -------------------
  480.  
  481.    The functions in this section are documented mainly because you can
  482. customize the naming conventions for backup files by redefining them.
  483. If you change one, you probably need to change the rest.
  484.  
  485.  - Function: backup-file-name-p FILENAME
  486.      This function returns a non-`nil' value if FILENAME is a possible
  487.      name for a backup file.  A file with the name FILENAME need not
  488.      exist; the function just checks the name.
  489.  
  490.           (backup-file-name-p "foo")
  491.                => nil
  492.  
  493.           (backup-file-name-p "foo~")
  494.                => 3
  495.  
  496.      The standard definition of this function is as follows:
  497.  
  498.           (defun backup-file-name-p (file)
  499.             "Return non-nil if FILE is a backup file \
  500.           name (numeric or not)..."
  501.             (string-match "~$" file))
  502.  
  503.      Thus, the function returns a non-`nil' value if the file name ends
  504.      with a `~'.  (We use a backslash to split the documentation
  505.      string's first line into two lines in the text, but produce just
  506.      one line in the string itself.)
  507.  
  508.      This simple expression is placed in a separate function to make it
  509.      easy to redefine for customization.
  510.  
  511.  - Function: make-backup-file-name FILENAME
  512.      This function returns a string that is the name to use for a
  513.      non-numbered backup file for file FILENAME.  On Unix, this is just
  514.      FILENAME with a tilde appended.
  515.  
  516.      The standard definition of this function is as follows:
  517.  
  518.           (defun make-backup-file-name (file)
  519.             "Create the non-numeric backup file name for FILE.
  520.           ..."
  521.             (concat file "~"))
  522.  
  523.      You can change the backup-file naming convention by redefining this
  524.      function.  The following example redefines `make-backup-file-name'
  525.      to prepend a `.' in addition to appending a tilde:
  526.  
  527.           (defun make-backup-file-name (filename)
  528.             (concat "." filename "~"))
  529.  
  530.           (make-backup-file-name "backups.texi")
  531.                => ".backups.texi~"
  532.  
  533.  - Function: find-backup-file-name FILENAME
  534.      This function computes the file name for a new backup file for
  535.      FILENAME.  It may also propose certain existing backup files for
  536.      deletion.  `find-backup-file-name' returns a list whose CAR is the
  537.      name for the new backup file and whose CDR is a list of backup
  538.      files whose deletion is proposed.
  539.  
  540.      Two variables, `kept-old-versions' and `kept-new-versions',
  541.      determine which backup versions should be kept.  This function
  542.      keeps those versions by excluding them from the CDR of the value.
  543.      *Note Numbered Backups::.
  544.  
  545.      In this example, the value says that `~rms/foo.~5~' is the name to
  546.      use for the new backup file, and `~rms/foo.~3~' is an "excess"
  547.      version that the caller should consider deleting now.
  548.  
  549.           (find-backup-file-name "~rms/foo")
  550.                => ("~rms/foo.~5~" "~rms/foo.~3~")
  551.  
  552.  - Function: file-newest-backup FILENAME
  553.      This function returns the name of the most recent backup file for
  554.      FILENAME, or `nil' if that file has no backup files.
  555.  
  556.      Some file comparison commands use this function so that they can
  557.      automatically compare a file with its most recent backup.
  558.  
  559. 
  560. File: lispref.info,  Node: Auto-Saving,  Next: Reverting,  Prev: Backup Files,  Up: Backups and Auto-Saving
  561.  
  562. Auto-Saving
  563. ===========
  564.  
  565.    XEmacs periodically saves all files that you are visiting; this is
  566. called "auto-saving".  Auto-saving prevents you from losing more than a
  567. limited amount of work if the system crashes.  By default, auto-saves
  568. happen every 300 keystrokes, or after around 30 seconds of idle time.
  569. *Note Auto-Save: (emacs)Auto-Save, for information on auto-save for
  570. users.  Here we describe the functions used to implement auto-saving
  571. and the variables that control them.
  572.  
  573.  - Variable: buffer-auto-save-file-name
  574.      This buffer-local variable is the name of the file used for
  575.      auto-saving the current buffer.  It is `nil' if the buffer should
  576.      not be auto-saved.
  577.  
  578.           buffer-auto-save-file-name
  579.           => "/xcssun/users/rms/lewis/#files.texi#"
  580.  
  581.  - Command: auto-save-mode ARG
  582.      When used interactively without an argument, this command is a
  583.      toggle switch: it turns on auto-saving of the current buffer if it
  584.      is off, and vice-versa.  With an argument ARG, the command turns
  585.      auto-saving on if the value of ARG is `t', a nonempty list, or a
  586.      positive integer.  Otherwise, it turns auto-saving off.
  587.  
  588.  - Function: auto-save-file-name-p FILENAME
  589.      This function returns a non-`nil' value if FILENAME is a string
  590.      that could be the name of an auto-save file.  It works based on
  591.      knowledge of the naming convention for auto-save files: a name that
  592.      begins and ends with hash marks (`#') is a possible auto-save file
  593.      name.  The argument FILENAME should not contain a directory part.
  594.  
  595.           (make-auto-save-file-name)
  596.                => "/xcssun/users/rms/lewis/#files.texi#"
  597.           (auto-save-file-name-p "#files.texi#")
  598.                => 0
  599.           (auto-save-file-name-p "files.texi")
  600.                => nil
  601.  
  602.      The standard definition of this function is as follows:
  603.  
  604.           (defun auto-save-file-name-p (filename)
  605.             "Return non-nil if FILENAME can be yielded by..."
  606.             (string-match "^#.*#$" filename))
  607.  
  608.      This function exists so that you can customize it if you wish to
  609.      change the naming convention for auto-save files.  If you redefine
  610.      it, be sure to redefine the function `make-auto-save-file-name'
  611.      correspondingly.
  612.  
  613.  - Function: make-auto-save-file-name
  614.      This function returns the file name to use for auto-saving the
  615.      current buffer.  This is just the file name with hash marks (`#')
  616.      appended and prepended to it.  This function does not look at the
  617.      variable `auto-save-visited-file-name' (described below); you
  618.      should check that before calling this function.
  619.  
  620.           (make-auto-save-file-name)
  621.                => "/xcssun/users/rms/lewis/#backup.texi#"
  622.  
  623.      The standard definition of this function is as follows:
  624.  
  625.           (defun make-auto-save-file-name ()
  626.             "Return file name to use for auto-saves \
  627.           of current buffer.
  628.           ..."
  629.             (if buffer-file-name
  630.                 (concat
  631.                  (file-name-directory buffer-file-name)
  632.                  "#"
  633.                  (file-name-nondirectory buffer-file-name)
  634.                  "#")
  635.               (expand-file-name
  636.                (concat "#%" (buffer-name) "#"))))
  637.  
  638.      This exists as a separate function so that you can redefine it to
  639.      customize the naming convention for auto-save files.  Be sure to
  640.      change `auto-save-file-name-p' in a corresponding way.
  641.  
  642.  - Variable: auto-save-visited-file-name
  643.      If this variable is non-`nil', XEmacs auto-saves buffers in the
  644.      files they are visiting.  That is, the auto-save is done in the
  645.      same file that you are editing.  Normally, this variable is `nil',
  646.      so auto-save files have distinct names that are created by
  647.      `make-auto-save-file-name'.
  648.  
  649.      When you change the value of this variable, the value does not take
  650.      effect until the next time auto-save mode is reenabled in any given
  651.      buffer.  If auto-save mode is already enabled, auto-saves continue
  652.      to go in the same file name until `auto-save-mode' is called again.
  653.  
  654.  - Function: recent-auto-save-p
  655.      This function returns `t' if the current buffer has been
  656.      auto-saved since the last time it was read in or saved.
  657.  
  658.  - Function: set-buffer-auto-saved
  659.      This function marks the current buffer as auto-saved.  The buffer
  660.      will not be auto-saved again until the buffer text is changed
  661.      again.  The function returns `nil'.
  662.  
  663.  - User Option: auto-save-interval
  664.      The value of this variable is the number of characters that XEmacs
  665.      reads from the keyboard between auto-saves.  Each time this many
  666.      more characters are read, auto-saving is done for all buffers in
  667.      which it is enabled.
  668.  
  669.  - User Option: auto-save-timeout
  670.      The value of this variable is the number of seconds of idle time
  671.      that should cause auto-saving.  Each time the user pauses for this
  672.      long, XEmacs auto-saves any buffers that need it.  (Actually, the
  673.      specified timeout is multiplied by a factor depending on the size
  674.      of the current buffer.)
  675.  
  676.  - Variable: auto-save-hook
  677.      This normal hook is run whenever an auto-save is about to happen.
  678.  
  679.  - User Option: auto-save-default
  680.      If this variable is non-`nil', buffers that are visiting files
  681.      have auto-saving enabled by default.  Otherwise, they do not.
  682.  
  683.  - Command: do-auto-save &optional NO-MESSAGE CURRENT-ONLY
  684.      This function auto-saves all buffers that need to be auto-saved.
  685.      It saves all buffers for which auto-saving is enabled and that
  686.      have been changed since the previous auto-save.
  687.  
  688.      Normally, if any buffers are auto-saved, a message that says
  689.      `Auto-saving...' is displayed in the echo area while auto-saving is
  690.      going on.  However, if NO-MESSAGE is non-`nil', the message is
  691.      inhibited.
  692.  
  693.      If CURRENT-ONLY is non-`nil', only the current buffer is
  694.      auto-saved.
  695.  
  696.  - Function: delete-auto-save-file-if-necessary
  697.      This function deletes the current buffer's auto-save file if
  698.      `delete-auto-save-files' is non-`nil'.  It is called every time a
  699.      buffer is saved.
  700.  
  701.  - Variable: delete-auto-save-files
  702.      This variable is used by the function
  703.      `delete-auto-save-file-if-necessary'.  If it is non-`nil', Emacs
  704.      deletes auto-save files when a true save is done (in the visited
  705.      file).  This saves disk space and unclutters your directory.
  706.  
  707.  - Function: rename-auto-save-file
  708.      This function adjusts the current buffer's auto-save file name if
  709.      the visited file name has changed.  It also renames an existing
  710.      auto-save file.  If the visited file name has not changed, this
  711.      function does nothing.
  712.  
  713.  - Variable: buffer-saved-size
  714.      The value of this buffer-local variable is the length of the
  715.      current buffer as of the last time it was read in, saved, or
  716.      auto-saved.  This is used to detect a substantial decrease in
  717.      size, and turn off auto-saving in response.
  718.  
  719.      If it is -1, that means auto-saving is temporarily shut off in this
  720.      buffer due to a substantial deletion.  Explicitly saving the buffer
  721.      stores a positive value in this variable, thus reenabling
  722.      auto-saving.  Turning auto-save mode off or on also alters this
  723.      variable.
  724.  
  725.  - Variable: auto-save-list-file-name
  726.      This variable (if non-`nil') specifies a file for recording the
  727.      names of all the auto-save files.  Each time XEmacs does
  728.      auto-saving, it writes two lines into this file for each buffer
  729.      that has auto-saving enabled.  The first line gives the name of
  730.      the visited file (it's empty if the buffer has none), and the
  731.      second gives the name of the auto-save file.
  732.  
  733.      If XEmacs exits normally, it deletes this file.  If XEmacs
  734.      crashes, you can look in the file to find all the auto-save files
  735.      that might contain work that was otherwise lost.  The
  736.      `recover-session' command uses these files.
  737.  
  738.      The default name for this file is in your home directory and
  739.      starts with `.saves-'.  It also contains the XEmacs process ID and
  740.      the host name.
  741.  
  742. 
  743. File: lispref.info,  Node: Reverting,  Prev: Auto-Saving,  Up: Backups and Auto-Saving
  744.  
  745. Reverting
  746. =========
  747.  
  748.    If you have made extensive changes to a file and then change your
  749. mind about them, you can get rid of them by reading in the previous
  750. version of the file with the `revert-buffer' command.  *Note Reverting
  751. a Buffer: (emacs)Reverting.
  752.  
  753.  - Command: revert-buffer &optional CHECK-AUTO-SAVE NOCONFIRM
  754.      This command replaces the buffer text with the text of the visited
  755.      file on disk.  This action undoes all changes since the file was
  756.      visited or saved.
  757.  
  758.      If the argument CHECK-AUTO-SAVE is non-`nil', and the latest
  759.      auto-save file is more recent than the visited file,
  760.      `revert-buffer' asks the user whether to use that instead.
  761.      Otherwise, it always uses the text of the visited file itself.
  762.      Interactively, CHECK-AUTO-SAVE is set if there is a numeric prefix
  763.      argument.
  764.  
  765.      Normally, `revert-buffer' asks for confirmation before it changes
  766.      the buffer; but if the argument NOCONFIRM is non-`nil',
  767.      `revert-buffer' does not ask for confirmation.
  768.  
  769.      Reverting tries to preserve marker positions in the buffer by
  770.      using the replacement feature of `insert-file-contents'.  If the
  771.      buffer contents and the file contents are identical before the
  772.      revert operation, reverting preserves all the markers.  If they
  773.      are not identical, reverting does change the buffer; then it
  774.      preserves the markers in the unchanged text (if any) at the
  775.      beginning and end of the buffer.  Preserving any additional
  776.      markers would be problematical.
  777.  
  778.    You can customize how `revert-buffer' does its work by setting these
  779. variables--typically, as buffer-local variables.
  780.  
  781.  - Variable: revert-buffer-function
  782.      The value of this variable is the function to use to revert this
  783.      buffer.  If non-`nil', it is called as a function with no
  784.      arguments to do the work of reverting.  If the value is `nil',
  785.      reverting works the usual way.
  786.  
  787.      Modes such as Dired mode, in which the text being edited does not
  788.      consist of a file's contents but can be regenerated in some other
  789.      fashion, give this variable a buffer-local value that is a
  790.      function to regenerate the contents.
  791.  
  792.  - Variable: revert-buffer-insert-file-contents-function
  793.      The value of this variable, if non-`nil', is the function to use to
  794.      insert the updated contents when reverting this buffer.  The
  795.      function receives two arguments: first the file name to use;
  796.      second, `t' if the user has asked to read the auto-save file.
  797.  
  798.  - Variable: before-revert-hook
  799.      This normal hook is run by `revert-buffer' before actually
  800.      inserting the modified contents--but only if
  801.      `revert-buffer-function' is `nil'.
  802.  
  803.      Font Lock mode uses this hook to record that the buffer contents
  804.      are no longer fontified.
  805.  
  806.  - Variable: after-revert-hook
  807.      This normal hook is run by `revert-buffer' after actually inserting
  808.      the modified contents--but only if `revert-buffer-function' is
  809.      `nil'.
  810.  
  811.      Font Lock mode uses this hook to recompute the fonts for the
  812.      updated buffer contents.
  813.  
  814. 
  815. File: lispref.info,  Node: Buffers,  Next: Windows,  Prev: Backups and Auto-Saving,  Up: Top
  816.  
  817. Buffers
  818. *******
  819.  
  820.    A "buffer" is a Lisp object containing text to be edited.  Buffers
  821. are used to hold the contents of files that are being visited; there may
  822. also be buffers that are not visiting files.  While several buffers may
  823. exist at one time, exactly one buffer is designated the "current
  824. buffer" at any time.  Most editing commands act on the contents of the
  825. current buffer.  Each buffer, including the current buffer, may or may
  826. not be displayed in any windows.
  827.  
  828. * Menu:
  829.  
  830. * Buffer Basics::       What is a buffer?
  831. * Current Buffer::      Designating a buffer as current
  832.                           so primitives will access its contents.
  833. * Buffer Names::        Accessing and changing buffer names.
  834. * Buffer File Name::    The buffer file name indicates which file is visited.
  835. * Buffer Modification:: A buffer is "modified" if it needs to be saved.
  836. * Modification Time::   Determining whether the visited file was changed
  837.                          "behind XEmacs's back".
  838. * Read Only Buffers::   Modifying text is not allowed in a read-only buffer.
  839. * The Buffer List::     How to look at all the existing buffers.
  840. * Creating Buffers::    Functions that create buffers.
  841. * Killing Buffers::     Buffers exist until explicitly killed.
  842. * Indirect Buffers::    An indirect buffer shares text with some other buffer.
  843.  
  844. 
  845. File: lispref.info,  Node: Buffer Basics,  Next: Current Buffer,  Up: Buffers
  846.  
  847. Buffer Basics
  848. =============
  849.  
  850.    A "buffer" is a Lisp object containing text to be edited.  Buffers
  851. are used to hold the contents of files that are being visited; there may
  852. also be buffers that are not visiting files.  While several buffers may
  853. exist at one time, exactly one buffer is designated the "current
  854. buffer" at any time.  Most editing commands act on the contents of the
  855. current buffer.  Each buffer, including the current buffer, may or may
  856. not be displayed in any windows.
  857.  
  858.    Buffers in Emacs editing are objects that have distinct names and
  859. hold text that can be edited.  Buffers appear to Lisp programs as a
  860. special data type.  You can think of the contents of a buffer as an
  861. extendable string; insertions and deletions may occur in any part of
  862. the buffer.  *Note Text::.
  863.  
  864.    A Lisp buffer object contains numerous pieces of information.  Some
  865. of this information is directly accessible to the programmer through
  866. variables, while other information is accessible only through
  867. special-purpose functions.  For example, the visited file name is
  868. directly accessible through a variable, while the value of point is
  869. accessible only through a primitive function.
  870.  
  871.    Buffer-specific information that is directly accessible is stored in
  872. "buffer-local" variable bindings, which are variable values that are
  873. effective only in a particular buffer.  This feature allows each buffer
  874. to override the values of certain variables.  Most major modes override
  875. variables such as `fill-column' or `comment-column' in this way.  For
  876. more information about buffer-local variables and functions related to
  877. them, see *Note Buffer-Local Variables::.
  878.  
  879.    For functions and variables related to visiting files in buffers, see
  880. *Note Visiting Files:: and *Note Saving Buffers::.  For functions and
  881. variables related to the display of buffers in windows, see *Note
  882. Buffers and Windows::.
  883.  
  884.  - Function: bufferp OBJECT
  885.      This function returns `t' if OBJECT is a buffer, `nil' otherwise.
  886.  
  887. 
  888. File: lispref.info,  Node: Current Buffer,  Next: Buffer Names,  Prev: Buffer Basics,  Up: Buffers
  889.  
  890. The Current Buffer
  891. ==================
  892.  
  893.    There are, in general, many buffers in an Emacs session.  At any
  894. time, one of them is designated as the "current buffer".  This is the
  895. buffer in which most editing takes place, because most of the primitives
  896. for examining or changing text in a buffer operate implicitly on the
  897. current buffer (*note Text::.).  Normally the buffer that is displayed
  898. on the screen in the selected window is the current buffer, but this is
  899. not always so: a Lisp program can designate any buffer as current
  900. temporarily in order to operate on its contents, without changing what
  901. is displayed on the screen.
  902.  
  903.    The way to designate a current buffer in a Lisp program is by calling
  904. `set-buffer'.  The specified buffer remains current until a new one is
  905. designated.
  906.  
  907.    When an editing command returns to the editor command loop, the
  908. command loop designates the buffer displayed in the selected window as
  909. current, to prevent confusion: the buffer that the cursor is in when
  910. Emacs reads a command is the buffer that the command will apply to.
  911. (*Note Command Loop::.)  Therefore, `set-buffer' is not the way to
  912. switch visibly to a different buffer so that the user can edit it.  For
  913. this, you must use the functions described in *Note Displaying
  914. Buffers::.
  915.  
  916.    However, Lisp functions that change to a different current buffer
  917. should not depend on the command loop to set it back afterwards.
  918. Editing commands written in XEmacs Lisp can be called from other
  919. programs as well as from the command loop.  It is convenient for the
  920. caller if the subroutine does not change which buffer is current
  921. (unless, of course, that is the subroutine's purpose).  Therefore, you
  922. should normally use `set-buffer' within a `save-excursion' that will
  923. restore the current buffer when your function is done (*note
  924. Excursions::.).  Here is an example, the code for the command
  925. `append-to-buffer' (with the documentation string abridged):
  926.  
  927.      (defun append-to-buffer (buffer start end)
  928.        "Append to specified buffer the text of the region.
  929.      ..."
  930.        (interactive "BAppend to buffer: \nr")
  931.        (let ((oldbuf (current-buffer)))
  932.          (save-excursion
  933.            (set-buffer (get-buffer-create buffer))
  934.            (insert-buffer-substring oldbuf start end))))
  935.  
  936. This function binds a local variable to the current buffer, and then
  937. `save-excursion' records the values of point, the mark, and the
  938. original buffer.  Next, `set-buffer' makes another buffer current.
  939. Finally, `insert-buffer-substring' copies the string from the original
  940. current buffer to the new current buffer.
  941.  
  942.    If the buffer appended to happens to be displayed in some window,
  943. the next redisplay will show how its text has changed.  Otherwise, you
  944. will not see the change immediately on the screen.  The buffer becomes
  945. current temporarily during the execution of the command, but this does
  946. not cause it to be displayed.
  947.  
  948.    If you make local bindings (with `let' or function arguments) for a
  949. variable that may also have buffer-local bindings, make sure that the
  950. same buffer is current at the beginning and at the end of the local
  951. binding's scope.  Otherwise you might bind it in one buffer and unbind
  952. it in another!  There are two ways to do this.  In simple cases, you may
  953. see that nothing ever changes the current buffer within the scope of the
  954. binding.  Otherwise, use `save-excursion' to make sure that the buffer
  955. current at the beginning is current again whenever the variable is
  956. unbound.
  957.  
  958.    It is not reliable to change the current buffer back with
  959. `set-buffer', because that won't do the job if a quit happens while the
  960. wrong buffer is current.  Here is what *not* to do:
  961.  
  962.      (let (buffer-read-only
  963.            (obuf (current-buffer)))
  964.        (set-buffer ...)
  965.        ...
  966.        (set-buffer obuf))
  967.  
  968. Using `save-excursion', as shown below, handles quitting, errors, and
  969. `throw', as well as ordinary evaluation.
  970.  
  971.      (let (buffer-read-only)
  972.        (save-excursion
  973.          (set-buffer ...)
  974.          ...))
  975.  
  976.  - Function: current-buffer
  977.      This function returns the current buffer.
  978.  
  979.           (current-buffer)
  980.                => #<buffer buffers.texi>
  981.  
  982.  - Function: set-buffer BUFFER-OR-NAME
  983.      This function makes BUFFER-OR-NAME the current buffer.  It does
  984.      not display the buffer in the currently selected window or in any
  985.      other window, so the user cannot necessarily see the buffer.  But
  986.      Lisp programs can in any case work on it.
  987.  
  988.      This function returns the buffer identified by BUFFER-OR-NAME.  An
  989.      error is signaled if BUFFER-OR-NAME does not identify an existing
  990.      buffer.
  991.  
  992. 
  993. File: lispref.info,  Node: Buffer Names,  Next: Buffer File Name,  Prev: Current Buffer,  Up: Buffers
  994.  
  995. Buffer Names
  996. ============
  997.  
  998.    Each buffer has a unique name, which is a string.  Many of the
  999. functions that work on buffers accept either a buffer or a buffer name
  1000. as an argument.  Any argument called BUFFER-OR-NAME is of this sort,
  1001. and an error is signaled if it is neither a string nor a buffer.  Any
  1002. argument called BUFFER must be an actual buffer object, not a name.
  1003.  
  1004.    Buffers that are ephemeral and generally uninteresting to the user
  1005. have names starting with a space, so that the `list-buffers' and
  1006. `buffer-menu' commands don't mention them.  A name starting with space
  1007. also initially disables recording undo information; see *Note Undo::.
  1008.  
  1009.  - Function: buffer-name &optional BUFFER
  1010.      This function returns the name of BUFFER as a string.  If BUFFER
  1011.      is not supplied, it defaults to the current buffer.
  1012.  
  1013.      If `buffer-name' returns `nil', it means that BUFFER has been
  1014.      killed.  *Note Killing Buffers::.
  1015.  
  1016.           (buffer-name)
  1017.                => "buffers.texi"
  1018.           
  1019.           (setq foo (get-buffer "temp"))
  1020.                => #<buffer temp>
  1021.           (kill-buffer foo)
  1022.                => nil
  1023.           (buffer-name foo)
  1024.                => nil
  1025.           foo
  1026.                => #<killed buffer>
  1027.  
  1028.  - Command: rename-buffer NEWNAME &optional UNIQUE
  1029.      This function renames the current buffer to NEWNAME.  An error is
  1030.      signaled if NEWNAME is not a string, or if there is already a
  1031.      buffer with that name.  The function returns `nil'.
  1032.  
  1033.      Ordinarily, `rename-buffer' signals an error if NEWNAME is already
  1034.      in use.  However, if UNIQUE is non-`nil', it modifies NEWNAME to
  1035.      make a name that is not in use.  Interactively, you can make
  1036.      UNIQUE non-`nil' with a numeric prefix argument.
  1037.  
  1038.      One application of this command is to rename the `*shell*' buffer
  1039.      to some other name, thus making it possible to create a second
  1040.      shell buffer under the name `*shell*'.
  1041.  
  1042.  - Function: get-buffer BUFFER-OR-NAME
  1043.      This function returns the buffer specified by BUFFER-OR-NAME.  If
  1044.      BUFFER-OR-NAME is a string and there is no buffer with that name,
  1045.      the value is `nil'.  If BUFFER-OR-NAME is a buffer, it is returned
  1046.      as given.  (That is not very useful, so the argument is usually a
  1047.      name.)  For example:
  1048.  
  1049.           (setq b (get-buffer "lewis"))
  1050.                => #<buffer lewis>
  1051.           (get-buffer b)
  1052.                => #<buffer lewis>
  1053.           (get-buffer "Frazzle-nots")
  1054.                => nil
  1055.  
  1056.      See also the function `get-buffer-create' in *Note Creating
  1057.      Buffers::.
  1058.  
  1059.  - Function: generate-new-buffer-name STARTING-NAME &optional IGNORE
  1060.      This function returns a name that would be unique for a new
  1061.      buffer--but does not create the buffer.  It starts with
  1062.      STARTING-NAME, and produces a name not currently in use for any
  1063.      buffer by appending a number inside of `<...>'.
  1064.  
  1065.      If IGNORE is given, it specifies a name that is okay to use (if it
  1066.      is in the sequence to be tried), even if a buffer with that name
  1067.      exists.
  1068.  
  1069.      See the related function `generate-new-buffer' in *Note Creating
  1070.      Buffers::.
  1071.  
  1072. 
  1073. File: lispref.info,  Node: Buffer File Name,  Next: Buffer Modification,  Prev: Buffer Names,  Up: Buffers
  1074.  
  1075. Buffer File Name
  1076. ================
  1077.  
  1078.    The "buffer file name" is the name of the file that is visited in
  1079. that buffer.  When a buffer is not visiting a file, its buffer file name
  1080. is `nil'.  Most of the time, the buffer name is the same as the
  1081. nondirectory part of the buffer file name, but the buffer file name and
  1082. the buffer name are distinct and can be set independently.  *Note
  1083. Visiting Files::.
  1084.  
  1085.  - Function: buffer-file-name &optional BUFFER
  1086.      This function returns the absolute file name of the file that
  1087.      BUFFER is visiting.  If BUFFER is not visiting any file,
  1088.      `buffer-file-name' returns `nil'.  If BUFFER is not supplied, it
  1089.      defaults to the current buffer.
  1090.  
  1091.           (buffer-file-name (other-buffer))
  1092.                => "/usr/user/lewis/manual/files.texi"
  1093.  
  1094.  - Variable: buffer-file-name
  1095.      This buffer-local variable contains the name of the file being
  1096.      visited in the current buffer, or `nil' if it is not visiting a
  1097.      file.  It is a permanent local, unaffected by
  1098.      `kill-local-variables'.
  1099.  
  1100.           buffer-file-name
  1101.                => "/usr/user/lewis/manual/buffers.texi"
  1102.  
  1103.      It is risky to change this variable's value without doing various
  1104.      other things.  See the definition of `set-visited-file-name' in
  1105.      `files.el'; some of the things done there, such as changing the
  1106.      buffer name, are not strictly necessary, but others are essential
  1107.      to avoid confusing XEmacs.
  1108.  
  1109.  - Variable: buffer-file-truename
  1110.      This buffer-local variable holds the truename of the file visited
  1111.      in the current buffer, or `nil' if no file is visited.  It is a
  1112.      permanent local, unaffected by `kill-local-variables'.  *Note
  1113.      Truenames::.
  1114.  
  1115.  - Variable: buffer-file-number
  1116.      This buffer-local variable holds the file number and directory
  1117.      device number of the file visited in the current buffer, or `nil'
  1118.      if no file or a nonexistent file is visited.  It is a permanent
  1119.      local, unaffected by `kill-local-variables'.  *Note Truenames::.
  1120.  
  1121.      The value is normally a list of the form `(FILENUM DEVNUM)'.  This
  1122.      pair of numbers uniquely identifies the file among all files
  1123.      accessible on the system.  See the function `file-attributes', in
  1124.      *Note File Attributes::, for more information about them.
  1125.  
  1126.  - Function: get-file-buffer FILENAME
  1127.      This function returns the buffer visiting file FILENAME.  If there
  1128.      is no such buffer, it returns `nil'.  The argument FILENAME, which
  1129.      must be a string, is expanded (*note File Name Expansion::.), then
  1130.      compared against the visited file names of all live buffers.
  1131.  
  1132.           (get-file-buffer "buffers.texi")
  1133.               => #<buffer buffers.texi>
  1134.  
  1135.      In unusual circumstances, there can be more than one buffer
  1136.      visiting the same file name.  In such cases, this function returns
  1137.      the first such buffer in the buffer list.
  1138.  
  1139.  - Command: set-visited-file-name FILENAME
  1140.      If FILENAME is a non-empty string, this function changes the name
  1141.      of the file visited in current buffer to FILENAME.  (If the buffer
  1142.      had no visited file, this gives it one.)  The *next time* the
  1143.      buffer is saved it will go in the newly-specified file.  This
  1144.      command marks the buffer as modified, since it does not (as far as
  1145.      XEmacs knows) match the contents of FILENAME, even if it matched
  1146.      the former visited file.
  1147.  
  1148.      If FILENAME is `nil' or the empty string, that stands for "no
  1149.      visited file".  In this case, `set-visited-file-name' marks the
  1150.      buffer as having no visited file.
  1151.  
  1152.      When the function `set-visited-file-name' is called interactively,
  1153.      it prompts for FILENAME in the minibuffer.
  1154.  
  1155.      See also `clear-visited-file-modtime' and
  1156.      `verify-visited-file-modtime' in *Note Buffer Modification::.
  1157.  
  1158.  - Variable: list-buffers-directory
  1159.      This buffer-local variable records a string to display in a buffer
  1160.      listing in place of the visited file name, for buffers that don't
  1161.      have a visited file name.  Dired buffers use this variable.
  1162.  
  1163.